<include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<style type="text/css">
    .certify_trace em {background: #cecece none repeat scroll 0 0;color: #000017;cursor: pointer;  display: inline-block;  height: 22px;  line-height: 22px;  padding: 0 50px;  text-align: center;}
    .certify_trace .active {  background: #20ab4f none repeat scroll 0 0;  color: #fff;}
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="rzgl.csdrz"/>
    <div class="mianR">
        <h3 class="yonghu">车商待认证详情</h3>
        <div class="new-dealer">
            <table class="table">
                <tbody>
                <tr>
                    <td width="15%">车商ID</td>
                    <td>{$detail.dealer_id}</td>
                </tr>
                <tr>
                    <td width="15%">手机号</td>
                    <td>{$detail.contact_mobile}</td>
                </tr>
                <tr>
                    <td width="15%">经营城市</td>
                    <td>{$detail.business_city_name}</td>
                </tr>
                <tr>
                    <td width="15%">客户经理</td>
                    <td>{$detail.manager_name}</td>
                </tr>
                <tr>
                    <td width="15%">注册时间</td>
                    <td>{$detail.reg_date}</td>
                </tr>

                </tbody>
            </table>
        </div>
        <if condition="$status egt 2">
            <h3 class="yonghu">系统跟踪日志</h3>
            <div class="new-dealer">
                <table class="table">
                    <thead>
                    <tr>
                        <th width="40%">跟踪备注</th>
                        <th width="30%">操作时间</th>
                        <th width="30%">操作人</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="wait_certify_trace_log" id="log" key="k">
                        <tr>
                            <td>{$log.remark}</td>
                            <td>{$log.createtime}</td>
                            <td>{$log.emp_name}</td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
            </div>
        </if>
        <form>
            <div class="xuanzhe1">
                <ul>
                    <li class="certify_trace">
                        <input type="hidden" id="certify_trace_type" value="{$detail.certify_trace_type|default=1}">
                        <span>跟踪结果</span>
                        <em class="active" data-id="1">继续跟踪</em>
                        <em data-id="2">不再跟踪</em>
                    </li>
                    <li class="remarks clearfix">
                        <span>备注</span>
                        <textarea name="trace_remark" id="trace_remark" cols="50" onKeyDown="textCounter(this.form.trace_remark, this.form.remLen, 50);" onKeyUp="textCounter(this.form.trace_remark, this.form.remLen, 50);" placeholder="请填写跟踪备注"></textarea>
                    </li>
                    <li class="clearfix" id="trace_time">
                        <span>下次跟踪时间</span>
                        <input id="demoText9" class="xiaci" name="next_trace_time" value="请选择下次跟踪时间" readonly="" type="text">
                    </li>
                </ul>
            </div>
        </form>
        <div class="yongBtn">
            <input type="hidden" name="id" value="{$detail.dealer_id}">
            <input type="submit" value="确定" class="queding"/>
            <input class="quxiao" type="submit" value="返回" onclick="history.back();">
        </div>
    </div>
    <div class="clear"></div>
</div>
<script type="text/javascript">
    $(function(){
        $(".certify_trace em").click(function () {
            $(".certify_trace em").removeClass("active");
            $("#certify_trace_type").val($(this).attr('data-id'));
            $(this).addClass("active");
            var trace_result = $(this).attr('data-id');
            if(trace_result == 1){
                $("#trace_time").show();
                $("textarea[name='trace_remark']").val("");
            }else{
                $("#trace_time").hide();
                $("textarea[name='trace_remark']").val("");
            }
        });

        $('.queding').on('click',function(){
            var id = $("input[name='id']").val();
            var trace_result = $('.active').attr('data-id');
            var trace_remark = $('#trace_remark').val();
            if(trace_remark == ''){
                shibai_alert('请填写跟踪备注');
                return;
            }
            var next_trace_time = $("input[name='next_trace_time']").val();
            if(trace_result == 1) {
                if (next_trace_time == '' || next_trace_time == '请选择下次跟踪时间') {
                    shibai_alert('请选择下次跟踪时间');
                    return;
                }
            }
            var params = {
                'id': id,
                'trace_result': trace_result,
                'trace_remark': trace_remark,
                'next_trace_time': next_trace_time
            }
            $(".yunBei").css("display","block").unbind('click');
            $(".loading").fadeIn();
            $.post("/CarDealerWaitCertify/do_wait_certify_track", params, function (data) {
                if(data.code != 200){
                    $(".loading").fadeOut();
                    $(".yunBei").css("display","none");
                    shibai_alert(data.msg);
                    return false;
                }
                btn_alert("操作成功", 2000, function () {
                    window.location.href = document.referrer;
                });
            }, 'json')
        });
    });
</script>
<include file="Public/foot" />